// create router and expose
import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/pages/Home.vue'
import News from '@/pages/News.vue'
import About from '@/pages/About.vue'
import Detail from '@/pages/Detail.vue'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            name: 'shouye',
            path: '/home',
            component: Home
        },
        {
            name: 'xinwen',
            path: '/news',
            component: News,
            children: [
                {
                    name: 'detail',
                    path: 'detail',
                    component: Detail,
                    // s1
                    // props: true
                    // s2
                    props(route) {
                        console.log(route);
                        return route.query
                    }
                    // props: {
                    //     a: 1,
                    //     b: 2,
                    //     c: 3
                    // }
                }
            ]
        },
        {
            name: 'guanyu',
            path: '/about',
            component: About
        },
        {
            path: '/',
            redirect: '/home'
        }
    ]
});

export default router